<template>
	<div>
		<el-form ref="form" :model="form" :rules="rules" label-width="80px">
			<el-row>
				<el-col :span="10">
					<el-form-item label="客户姓名" :disabled="true"  prop="customerName"><el-input v-model="form.customerName"></el-input></el-form-item>
				</el-col>

				<el-col :span="10">
					<el-form-item label="护理项目" prop="nursingProject" label-width="130px"><el-input v-model="form.nursingProject"></el-input></el-form-item>
				</el-col>
			</el-row>

			<el-row>
				<el-col :span="10">
					<el-form-item label="护理时间" prop="nursingTime" label-width="80px">
						<el-date-picker v-model="form.nursingTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"></el-date-picker>
					</el-form-item>
				</el-col>

				<el-col :span="10">
					<el-form-item label="数量" prop="number" label-width="100px"><el-input v-model="form.number"></el-input></el-form-item>
				</el-col>
			</el-row>

			<el-row>
				<el-col :span="10">
					<el-form-item label="护理内容"><el-input v-model="form.content"></el-input></el-form-item>
				</el-col>

				<el-col :span="10">
					<el-form-item label="护理人员" label-width="130px"><el-input v-model="form.nursingStaff"></el-input></el-form-item>
				</el-col>
			</el-row>

			<el-row></el-row>

			<el-form-item><el-button type="primary" plain @click="save">保存数据</el-button></el-form-item>
		</el-form>
	</div>
</template>

<script>
import axios from '@/utils/axiosutils.js';
export default {
	name: 'nurserecordSet',
	props: ['editid'],
	components: {},
	data() {
		return {
			form: {
				customerName: '',
				nursingProject: '',
				nursingTime: '',
				number: '',
				content: '',
				nursingStaff: ''
			},
			rules: {
				customerName: [
					{
						required: true,
						message: '请输入',
						trigger: 'blur'
					}
				],
				nursingProject: [
					{
						required: true,
						message: '请输入',
						trigger: 'blur'
					}
				],
				nursingTime: [
					{
						required: true,
						message: '请输入',
						trigger: 'blur'
					}
				],
				number: [
					{
						required: true,
						message: '请输入',
						trigger: 'blur'
					}
				]
			}
		};
	},
	created() {
		console.log("id:"+this.editid)
		axios.get(
			'/customer/getById',
			response => {
				console.log(response);
				this.form.customerName = response.obj.customerName;
			},
			{
				customerId: this.editid
			}
		);
	},

	methods: {
		save: function() {
			axios.post(
				'/nurseRecords/add',
				resp => {
					this.$emit('update:show', false);
					this.$emit('getData');
				},
				this.form
			);
		}
	}
};
</script>

<style></style>
